package com.example.xposeddemo;

import static com.example.xposeddemo.HTool.GetCatValue;

import android.util.Log;

import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XSharedPreferences;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.XC_MethodHook;



public class Tutorial implements IXposedHookLoadPackage {
    public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {
        Log.w("bbb","Loaded app: " + lpparam.packageName);
        XposedBridge.log("Loaded app: " + lpparam.packageName);
        XposedHelpers.setStaticObjectField(android.os.Build.class, "BRAND", "xxx");
        String clazz = "com.linkage.mobile72.shanxi.utils";
        XposedHelpers.findAndHookMethod(clazz, lpparam.classLoader, "checkRoot", new XC_MethodHook() {
            @Override
            protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                super.beforeHookedMethod(param);
            }

            @Override
            protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                super.afterHookedMethod(param);
                param.setResult(false);
//                if (param.getResult() != null) {
//                    if (param.getResult().getClass().equals(byte[].class)) {
//                        XposedBridge.log(parseByte2HexStr((byte[]) param.getResult()));
//                    } else {
//                        XposedBridge.log("class_name:" + class_name + "    fun_name:" + fun_name + ":" + param.getResult().toString());
//                    }
//                }
            }
        });
//        SystemPropertiesHook systemPropertiesHook = new SystemPropertiesHook();
//        //systemProperties hook
//        XposedHelpers.findAndHookMethod("android.os.SystemProperties", lpparam.classLoader, "get", String.class, String.class, systemPropertiesHook);
    }
}
